package com.foreknow.elmboot.controller;

import com.foreknow.elmboot.po.User;
import com.foreknow.elmboot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/UserController")
public class UserController {

    @Autowired
    private UserService userService;
//登录
    @RequestMapping("/getUserByIdByPass")
    public Object getUserByIdByPass(User user){

        User userByIdByPass = userService.getUserByIdByPass(user.getUserId(), user.getPassword());
        if (userByIdByPass!=null){
            return userByIdByPass;
        }

        return null;

    }

//    注册
    @RequestMapping("/saveUser")
    public Integer saveUser(User user){

        return  userService.saveUser(user);


    }


}
